package com.sino.struts2;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.ISharePeopleService;
import com.sino.model.SharePeopleModel;

public class SharePeopleAction extends ActionSupport{
	ISharePeopleService sharePeopleServcie = null;
	
	SharePeopleModel sharePeopleModel = null;
	private String zlid;
	public String getZlid() {
		return zlid;
	}
	public void setZlid(String zlid) {
		this.zlid = zlid;
	}
	//显示共有专利人信息
	public String viewSharePeople(){
		return this.SUCCESS;
	}
	//保存共有专利人信息
	public String saveSharePeople(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		sharePeopleModel.setZlId(zlId);
		this.getSharePeopleServcie().saveSharePeople(sharePeopleModel);
		return this.SUCCESS;
	}
	//更新共有专利人信息
	public String updateSharePeople(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		sharePeopleModel.setZlId(zlId);
		this.getSharePeopleServcie().saveSharePeople(sharePeopleModel);
		return this.SUCCESS;
	}
	//查找共有专利人信息
	public String findSharePeople(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		this.setSharePeopleModel(this.getSharePeopleServcie().findSharePeople(zlId));
		return this.SUCCESS;
	}
	public String findSharePeopleToPrint(){
	
		this.setSharePeopleModel(this.getSharePeopleServcie().findSharePeople(zlid));
		return this.SUCCESS;
	}
	//查找共有专利人信息--------用于更新
	public String findUpdateSharePeople(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		this.setSharePeopleModel(this.getSharePeopleServcie().findSharePeople(zlId));
		return this.SUCCESS;
	}
	//----------------------------------------接口
	public SharePeopleModel getSharePeopleModel() {
		return sharePeopleModel;
	}

	public void setSharePeopleModel(SharePeopleModel sharePeopleModel) {
		this.sharePeopleModel = sharePeopleModel;
	}

	public ISharePeopleService getSharePeopleServcie() {
		return sharePeopleServcie;
	}

	public void setSharePeopleServcie(ISharePeopleService sharePeopleServcie) {
		this.sharePeopleServcie = sharePeopleServcie;
	}
	
	
}
